{{csrf_field()}}
<div class="layui-form-item">
    <label for="" class="layui-form-label">上级导航</label>
    <div class="layui-input-block">
        <select name="parent_id" lay-search  lay-filter="parent_id">
            <option value="0">一级导航</option>
            @foreach($navigations as $first)
                <option value="{{ $first['id'] }}" @if(isset($navigation->parent_id)&&$navigation->parent_id==$first['id']) selected @endif>{{ $first['name'] }}</option>
                @if(isset($first['_child']))
                    @foreach($first['_child'] as $second)
                        <option value="{{$second['id']}}" {{ isset($navigation->id) && $navigation->parent_id==$second['id'] ? 'selected' : '' }} >&nbsp;&nbsp;┗━━{{$second['name']}}</option>
                    @endforeach
                @endif
            @endforeach
        </select>
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">导航名称</label>
    <div class="layui-input-block">
        <input type="text" name="name" value="{{ $navigation->name ?? old('name') }}" lay-verify="required" placeholder="请输入导航名称" class="layui-input" >
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">跳转网址</label>
    <div class="layui-input-block">
        <input type="text" name="url" value="{{ $navigation->url ?? old('url') }}" placeholder="请输入跳转网址" class="layui-input" >
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">类型</label>
    <div class="layui-input-inline">
        <input type="radio" name="type" value="F" title="默认" @if(isset($navigation->type) && $navigation->type == 'F') checked @elseif(!isset($navigation->type)) checked @endif >
        <input type="radio" name="type" value="T" title="动态" @if(isset($navigation->type) && $navigation->type == 'T') checked @endif>
    </div>
    <div class="layui-form-mid layui-word-aux">动态网址：即根据所选地区变动</div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">打开方式</label>
    <div class="layui-input-block">
        <input type="radio" name="target" value="" title="默认方式" @if(isset($navigation->target) && $navigation->target != '_blank') checked @elseif(!isset($navigation->target)) checked @endif >
        <input type="radio" name="target" value="_blank" title="新窗口打开" @if(isset($navigation->target) && $navigation->target == '_blank') checked @endif>
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">排序</label>
    <div class="layui-input-block">
        <input type="text" name="sort" value="{{ $navigation->sort ?? 0 }}" lay-verify="required|number" placeholder="请输入数字" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">状态</label>
    <div class="layui-input-block">
        <input type="radio" name="status" value="T" title="显示" @if(isset($navigation->status) && $navigation->status == 'T') checked @elseif(!isset($navigation->status)) checked @endif >
        <input type="radio" name="status" value="F" title="隐藏" @if(isset($navigation->status) && $navigation->status == 'F') checked @endif>
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="submit" class="layui-btn" lay-submit="" lay-filter="formDemo">确 认</button>
        <a  class="layui-btn" href="{{route('admin.navigation')}}" >返 回</a>
    </div>
</div>